package it.polimi.digitalstate.entities;

import it.polimi.digitalstate.dto.CitizenDTO;

import java.io.Serializable;
import java.lang.String;
import java.sql.Date;

import javax.persistence.*;

/**
 * Entity implementation class for Entity: Citizen
 *
 */
@Entity
@NamedQueries(value = { 
		@NamedQuery(name = "citizen_getByID", query = "select c from Citizen c where c.id = :id" ), 
		@NamedQuery(name = "citizen_getByEcode", query = "select c from Citizen c where c.ecode = :ecode" )})
public class Citizen implements Serializable, IEntity {
	//TODO set the unique constraint correctly
	   
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private int id;
	@Column(unique=true)
	private String ecode;
	private String name;
	private String surname;
	private Date dob;
	private String gender;
	private static final long serialVersionUID = 1L;

	public Citizen() {
		super();
	}   
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}   
	public String getEcode() {
		return this.ecode;
	}

	public void setEcode(String ecode) {
		this.ecode = ecode;
	}   
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}   
	public String getSurname() {
		return this.surname;
	}

	public void setSurname(String surname) {
		this.surname = surname;
	}   
	public Date getDob() {
		return this.dob;
	}

	public void setDob(Date dob) {
		this.dob = dob;
	}   
	public String getGender() {
		return this.gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}
	public CitizenDTO getDTO(){
		return new CitizenDTO(id,ecode,name, surname,dob);
	}
   
}
